﻿using CPF;
using CPF.Animation;
using CPF.Charts;
using CPF.Controls;
using CPF.Documents;
using CPF.Drawing;
using CPF.Input;
using CPF.Shapes;
using CPF.Styling;
using CPF.Svg;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CPFManager
{
    public class Window1 : Window
    {
        protected override void InitializeComponent()
        {
            Icon = "res://CPFManager/icon.png";
            LoadStyleFile("res://CPFManager/Stylesheet1.css");
            //加载样式文件，文件需要设置为内嵌资源
            CanResize = true;
            Title = "XX管理系统";
            Width = 952;
            Height = 580;
            Background = null;
            Children.Add(new WindowFrame(this, new Panel
            {
                Width = "100%",
                Height = "100%",
                Children =
                {
                    new TabControl
                    {
                        PresenterFor = this,
                        Name = "mainTabControl",
                        TabStripPlacement = Dock.Left,
                        Items =
                        {
                            new TabItem
                            {
                                Content = new Grid
                                {
                                    ColumnDefinitions =
                                    {
                                        new ColumnDefinition
                                        {
                                            
                                        },
                                        new ColumnDefinition
                                        {
                                            
                                        },
                                    },
                                    RowDefinitions =
                                    {
                                        new RowDefinition
                                        {
                                            Height="auto"
                                        },
                                        new RowDefinition
                                        {
                                            
                                        },
                                        new RowDefinition
                                        {
                                            
                                        }
                                    },
                                    Children =
                                    {
                                        new Border
                                        {
                                            Attacheds =
                                            {
                                                {
                                                    Grid.RowIndex,
                                                    1
                                                },
                                            },
                                            Child = new Panel
                                            {
                                                Children =
                                                {
                                                    new Chart
                                                    {
                                                        YAxisFill = "#6A6A6A",
                                                        XAxisFill = "#6A6A6A",
                                                        CanScroll = false,
                                                        Bindings =
                                                        {
                                                            {
                                                                nameof(Chart.Data),
                                                                "销量"
                                                            },
                                                        },
                                                        MarginBottom = 4,
                                                        MarginRight = 12,
                                                        MarginLeft = 11,
                                                        MarginTop = 44,
                                                        XAxis =
                                                        {
                                                            "1月",
                                                            "2月",
                                                            "3月",
                                                            "4月",
                                                            "5月",
                                                            "6月",
                                                            "7月",
                                                            "8月",
                                                            "9月",
                                                            "10月"
                                                        }
                                                    },
                                                    new TextBlock
                                                    {
                                                        Classes = "title",
                                                        MarginLeft = 14,
                                                        MarginTop = 8,
                                                        Text = "销量",
                                                    }
                                                },
                                                Height = "100%",
                                                Width = "100%",
                                            },
                                            ShadowColor = "#00000033",
                                            ShadowBlur = 10,
                                            Classes = "widget",
                                            Height = "100%",
                                            Width = "100%",
                                        },
                                        new Border
                                        {
                                            Child = new Panel
                                            {
                                                Children =
                                                {
                                                    new Chart
                                                    {
                                                        YAxisFill = "#6A6A6A",
                                                        XAxisFill = "#6A6A6A",
                                                        CanScroll = false,
                                                        Bindings =
                                                        {
                                                            {
                                                                nameof(Chart.Data),
                                                                "利润"
                                                            },
                                                        },
                                                        MarginBottom = 4,
                                                        MarginRight = 12,
                                                        MarginLeft = 11,
                                                        MarginTop = 44,
                                                        XAxis =
                                                        {
                                                            "1月",
                                                            "2月",
                                                            "3月",
                                                            "4月",
                                                            "5月",
                                                            "6月",
                                                            "7月",
                                                            "8月",
                                                            "9月",
                                                            "10月"
                                                        }
                                                    },
                                                    new TextBlock
                                                    {
                                                        Classes = "title",
                                                        MarginLeft = 14,
                                                        MarginTop = 8,
                                                        Text = "利润",
                                                    }
                                                },
                                                Height = "100%",
                                                Width = "100%",
                                            },
                                            ShadowColor = "#00000033",
                                            ShadowBlur = 10,
                                            Attacheds =
                                            {
                                                {
                                                    Grid.RowIndex,
                                                    1
                                                },
                                                {
                                                    Grid.ColumnIndex,
                                                    1
                                                },
                                            },
                                            Classes = "widget",
                                            Height = "100%",
                                            Width = "100%",
                                        },
                                        new TextBlock
                                        {
                                            Foreground = "#2C304D",
                                            FontSize = 22f,
                                            MarginLeft = 7,
                                            Text = "控制面板",
                                        },
                                        new Border
                                        {
                                            Attacheds =
                                            {
                                                {
                                                    Grid.RowIndex,
                                                    2
                                                },
                                            },
                                            Child = new Panel
                                            {
                                                Children =
                                                {
                                                    new PieChart
                                                    {
                                                        Bindings =
                                                        {
                                                            {
                                                                nameof(PieChart.Data),
                                                                "销量比例"
                                                            },
                                                        },
                                                        MarginBottom = 4,
                                                        MarginRight = 12,
                                                        MarginLeft = 11,
                                                        MarginTop = 44,
                                                    },
                                                    new TextBlock
                                                    {
                                                        Classes = "title",
                                                        MarginLeft = 14,
                                                        MarginTop = 8,
                                                        Text = "销量比例",
                                                    }
                                                },
                                                Height = "100%",
                                                Width = "100%",
                                            },
                                            ShadowColor = "#00000033",
                                            ShadowBlur = 10,
                                            Classes = "widget",
                                            Height = "100%",
                                            Width = "100%",
                                        },
                                        new Border
                                        {
                                            Attacheds =
                                            {
                                                {
                                                    Grid.RowIndex,
                                                    2
                                                },
                                                {
                                                    Grid.ColumnIndex,
                                                    2
                                                },
                                            },
                                            Child = new Panel
                                            {
                                                Children =
                                                {
                                                    new PieChart
                                                    {
                                                        RingWidth = "50%",
                                                        Bindings =
                                                        {
                                                            {
                                                                nameof(PieChart.Data),
                                                                "利润比例"
                                                            },
                                                        },
                                                        MarginBottom = 4,
                                                        MarginRight = 12,
                                                        MarginLeft = 11,
                                                        MarginTop = 44,
                                                    },
                                                    new TextBlock
                                                    {
                                                        Classes = "title",
                                                        MarginLeft = 14,
                                                        MarginTop = 8,
                                                        Text = "利润比例",
                                                    }
                                                },
                                                Height = "100%",
                                                Width = "100%",
                                            },
                                            ShadowColor = "#00000033",
                                            ShadowBlur = 10,
                                            Classes = "widget",
                                            Height = "100%",
                                            Width = "100%",
                                        }
                                    },
                                    Height = "100%",
                                    Width = "100%",
                                },
                                Header = new StackPanel
                                {
                                    MarginTop = 0,
                                    MarginLeft = 3,
                                    Orientation = Orientation.Horizontal,
                                    Classes = "imgAndText",
                                    IsGroup = true,
                                    Children =
                                    {
                                        new SVG
                                        {
                                            IsAntiAlias = true,
                                            Fill = "#FFFFFF",
                                            Source = "res://CPFManager/svg/控制面板.svg",
                                            Classes = "img",
                                            Height = 20,
                                            Width = 20,
                                            Stretch = Stretch.Uniform,
                                        },
                                        new TextBlock
                                        {
                                            MarginLeft = 12f,
                                            Classes = "text",
                                            Text = "控制面板",
                                        },
                                    },
                                },
                            },
                            new TabItem
                            {
                                Content = new Panel
                                {
                                    Children =
                                    {
                                        new TextBlock
                                        {
                                            MarginTop = 0,
                                            Foreground = "#2C304D",
                                            FontSize = 22f,
                                            MarginLeft = 7,
                                            Text = "表格",
                                        },
                                        new Border
                                        {
                                            MarginLeft = 0,
                                            MarginRight = 7,
                                            MarginBottom = 12,
                                            MarginTop = 53,
                                            Child = new DataGrid
                                            {
                                                AlternationCount = 2,
                                                Bindings =
                                                {
                                                    {
                                                        "Items",
                                                        "表格数据"
                                                    },
                                                },
                                                Columns =
                                                {
                                                    new DataGridTextColumn
                                                    {
                                                        Header="列1",
                                                        Binding=new DataGridBinding("Item1"),
                                                        Width="*"
                                                    },
                                                    new DataGridTextColumn
                                                    {
                                                        Header="图片",
                                                        Binding=new DataGridBinding("Item2"),
                                                        Width="*"
                                                    },
                                                    new DataGridTemplateColumn
                                                    {
                                                        Header="自定义模板",
                                                        Binding=new DataGridBinding("Item3"),
                                                        Width=100,
                                                        CellTemplate=typeof(CellTemplate)
                                                    },
                                                    new DataGridTemplateColumn
                                                    {
                                                        Header="操作",
                                                        Width=100,
                                                        CellTemplate=typeof(OperationCellTemplate)
                                                    }
                                                },
                                                MarginBottom = 11,
                                                MarginTop = 10,
                                                MarginRight = 1,
                                                MarginLeft = 0,
                                            },
                                            ShadowColor = "#00000033",
                                            ShadowBlur = 10,
                                            Classes = "widget",
                                        },
                                        new Border
                                        {
                                            MarginRight = -1,
                                            MarginTop = 1,
                                            Child = new Panel
                                            {
                                                Classes = "textBox,searchBox",
                                                IsGroup = true,
                                                Attacheds =
                                                {
                                                    {
                                                        AttachedExtenstions.IsEmpty,
                                                        true,
                                                        nameof(TextBox.Text),
                                                        a=>a.GetChildren().First(b=>b is TextBox),
                                                        BindingMode.OneWay,
                                                        (string text)=>string.IsNullOrWhiteSpace(text)
                                                    }
                                                },
                                                Children =
                                                {
                                                    new TextBox
                                                    {
                                                        MarginTop = 3,
                                                        MarginBottom = 3,
                                                        MarginRight = 33,
                                                        MarginLeft = 3,
                                                        Classes = "singleLine",
                                                    },
                                                    new Button
                                                    {
                                                        MarginTop = 0,
                                                        MarginBottom = 0,
                                                        MarginRight = 0,
                                                        Width = 30,
                                                        Content = new SVG
                                                        {
                                                            IsAntiAlias = true,
                                                            Stretch= Stretch.Uniform,
                                                            Width=16,
                                                            Source = "<svg><path d=\"M903.744 813.248L760.768 670.272A381.952 381.952 0 0 0 832 448a384 384 0 1 0-384 384 381.952 381.952 0 0 0 222.272-71.232l142.976 142.976a63.936 63.936 0 1 0 90.496-90.496zM192 448a256 256 0 1 1 512 0 256 256 0 0 1-512 0z\"></path></svg>",
                                                        },
                                                    },
                                                    new TextBlock
                                                    {
                                                        MarginLeft = 8,
                                                        Classes = "placeholder",
                                                        Text = "搜索",
                                                    }
                                                },
                                                Height = 30,
                                                Width = 200,
                                            },
                                            ShadowColor = "#00000033",
                                            ShadowBlur = 10,
                                            Classes = "widget",
                                        },
                                        new Panel
                                        {
                                            Width = 239,
                                            MarginRight = 228,
                                            MarginTop = 8,
                                            Classes = "oneLine",
                                            IsGroup = true,
                                            Children =
                                            {
                                                new TextBlock
                                                {
                                                    Classes = "label",
                                                    MarginLeft = 7,
                                                    Text = "搜索条件：",
                                                },
                                                new ComboBox
                                                {
                                                    Height = 29,
                                                    Width = 158,
                                                    MarginRight = 8,
                                                    Items =
                                                    {
                                                        "231",
                                                        "sdaf",
                                                        "dfs",
                                                        "fgsfs",
                                                        "dfsgd",
                                                        "dgds",
                                                        "hdfs",
                                                        "fgdgssa",
                                                        "dgds",
                                                        "ghdfs",
                                                        "fgd",
                                                        "ghdfs",
                                                        "fggd",
                                                        "sdfs",
                                                        "fghdsa"
                                                    }
                                                },
                                            },
                                            Height = 38,
                                        }
                                    },
                                    Height = "100%",
                                    Width = "100%",
                                },
                                Header = new StackPanel
                                {
                                    MarginTop = 0,
                                    MarginLeft = 3,
                                    Orientation = Orientation.Horizontal,
                                    Classes = "imgAndText",
                                    IsGroup = true,
                                    Children =
                                    {
                                        new SVG
                                        {
                                            IsAntiAlias = true,
                                            Fill = "#FFFFFF",
                                            Source = "res://CPFManager/svg/表格.svg",
                                            Classes = "img",
                                            Height = 20,
                                            Width = 20,
                                            Stretch = Stretch.Uniform,
                                        },
                                        new TextBlock
                                        {
                                            MarginLeft = 12f,
                                            Classes = "text",
                                            Text = "表格",
                                        },
                                    },
                                },
                            },
                            new TabItem
                            {
                                Content = new Panel
                                {
                                    Children =
                                    {
                                        new TextBlock
                                        {
                                            MarginTop = 0,
                                            Foreground = "#2C304D",
                                            FontSize = 22f,
                                            MarginLeft = 7,
                                            Text = "表单",
                                        },
                                        new Border
                                        {
                                            Child = new Panel
                                            {
                                                Children =
                                                {
                                                    new Panel
                                                    {
                                                        MarginLeft = 19,
                                                        MarginTop = 19,
                                                        Classes = "oneLine",
                                                        IsGroup = true,
                                                        Children =
                                                        {
                                                            new TextBlock
                                                            {
                                                                Classes = "label",
                                                                MarginLeft = 7,
                                                                Text = "标签",
                                                            },
                                                            new TextBox
                                                            {
                                                                Height = 30,
                                                                Classes = "singleLine,textBox",
                                                                Width = 158,
                                                                MarginRight = 8,
                                                            },
                                                        },
                                                        Height = 38,
                                                        Width = 245,
                                                    },
                                                    new Panel
                                                    {
                                                        MarginBottom = 356,
                                                        MarginLeft = 19,
                                                        MarginTop = 57,
                                                        Classes = "oneLine",
                                                        IsGroup = true,
                                                        Children =
                                                        {
                                                            new TextBlock
                                                            {
                                                                Classes = "label",
                                                                MarginLeft = 7,
                                                                Text = "标签",
                                                            },
                                                            new ComboBox
                                                            {
                                                                Height = 29,
                                                                Width = 158,
                                                                MarginRight = 8,
                                                                Items =
                                                                {
                                                                    "231",
                                                                    "sdaf",
                                                                    "dfs",
                                                                    "fgsfs",
                                                                    "dfsgd",
                                                                    "dgds",
                                                                    "hdfs",
                                                                    "fgdgssa",
                                                                    "dgds",
                                                                    "ghdfs",
                                                                    "fgd",
                                                                    "ghdfs",
                                                                    "fggd",
                                                                    "sdfs",
                                                                    "fghdsa"
                                                                }
                                                            },
                                                        },
                                                        Height = 38,
                                                        Width = 245,
                                                    },
                                                    new Panel
                                                    {
                                                        MarginLeft = 19,
                                                        MarginTop = 95,
                                                        Classes = "twoLine",
                                                        IsGroup = true,
                                                        Children =
                                                        {
                                                            new TextBlock
                                                            {
                                                                MarginTop = 9,
                                                                Classes = "label",
                                                                MarginLeft = 7,
                                                                Text = "标签",
                                                            },
                                                            new TextBox
                                                            {
                                                                MarginLeft = 7,
                                                                MarginTop = 33,
                                                                Height = 25,
                                                                Classes = "singleLine,textBox",
                                                                MarginRight = 7,
                                                            },
                                                        },
                                                        Height = 64,
                                                        Width = 245,
                                                    },
                                                    new Panel
                                                    {
                                                        MarginLeft = 98,
                                                        MarginTop = 162,
                                                        Classes = "textBox",
                                                        Attacheds =
                                                        {
                                                            {
                                                                AttachedExtenstions.IsEmpty,
                                                                true,
                                                                nameof(TextBox.Text),
                                                                a=>a.GetChildren().First(b=>b is TextBox),
                                                                BindingMode.OneWay,
                                                                (string text)=>string.IsNullOrWhiteSpace(text)
                                                            }
                                                        },
                                                        IsGroup = true,
                                                        Children =
                                                        {
                                                            new TextBox
                                                            {
                                                                MarginBottom = 3,
                                                                MarginRight = 3,
                                                                MarginLeft = 3,
                                                                MarginTop = 3,
                                                                Classes = "singleLine",
                                                            },
                                                            new TextBlock
                                                            {
                                                                MarginLeft = 8,
                                                                Classes = "placeholder",
                                                                Text = "placeholder",
                                                            },
                                                        },
                                                        Height = 30,
                                                        Width = 160,
                                                    },
                                                    new TextBlock
                                                    {
                                                        MarginLeft = 28,
                                                        MarginTop = 169,
                                                        Classes = "label",
                                                        Text = "标签",
                                                    },
                                                    new CheckBox
                                                    {
                                                        MarginLeft = 28,
                                                        MarginTop = 207,
                                                        Content = "CheckBox",
                                                    },
                                                    new CheckBox
                                                    {
                                                        MarginLeft = 130,
                                                        MarginTop = 207,
                                                        Content = "CheckBox",
                                                    },
                                                    new RadioButton
                                                    {
                                                        MarginLeft = 27,
                                                        MarginTop = 242,
                                                        Content = "RadioButton",
                                                    },
                                                    new RadioButton
                                                    {
                                                        MarginLeft = 167,
                                                        MarginTop = 242,
                                                        Content = "RadioButton",
                                                    },
                                                    new Panel
                                                    {
                                                        MarginLeft = 403,
                                                        MarginTop = 94,
                                                        Attacheds =
                                                        {
                                                            {
                                                                AttachedExtenstions.IsError,
                                                                false,
                                                                nameof(TextBox.Text),
                                                                a=>a.GetChildren().First(b=>b is TextBox),
                                                                BindingMode.OneWay,
                                                                (string text)=>string.IsNullOrWhiteSpace(text)
                                                            }
                                                        },
                                                        Classes = "twoLine",
                                                        IsGroup = true,
                                                        Children =
                                                        {
                                                            new TextBlock
                                                            {
                                                                MarginTop = 9,
                                                                Classes = "label",
                                                                MarginLeft = 7,
                                                                Text = "标签",
                                                            },
                                                            new TextBox
                                                            {
                                                                Width = 204,
                                                                MarginLeft = 7,
                                                                MarginTop = 33,
                                                                Height = 25,
                                                                Classes = "singleLine,textBox",
                                                            },
                                                            new TextBlock
                                                            {
                                                                MarginLeft = 217,
                                                                Classes = "error",
                                                                MarginTop = 37,
                                                                Text = "不能为空！",
                                                            },
                                                        },
                                                        Height = 65,
                                                        Width = 274,
                                                    },
                                                    new Panel
                                                    {
                                                        MarginLeft = 410,
                                                        MarginTop = 24,
                                                        IsGroup = true,
                                                        Children =
                                                        {
                                                            new TextBox
                                                            {
                                                                MarginRight = 42.3f,
                                                                MarginLeft = 2f,
                                                                MarginTop = 0f,
                                                                MarginBottom = 0f,
                                                                Classes = "singleLine",
                                                            },
                                                            new Border
                                                            {
                                                                Child = new TextBlock
                                                                {
                                                                    Foreground = "#9093A2",
                                                                    MarginRight = 5f,
                                                                    MarginLeft = 5f,
                                                                    Text = ".com",
                                                                },
                                                                Classes = "slotLeft",
                                                            },
                                                        },
                                                        Classes = "textBox,groupPanel",
                                                        Width = 267,
                                                        Height = 27,
                                                    },
                                                    new Panel
                                                    {
                                                        MarginLeft = 403,
                                                        MarginTop = 57,
                                                        Classes = "oneLine",
                                                        IsGroup = true,
                                                        Children =
                                                        {
                                                            new TextBlock
                                                            {
                                                                Classes = "label",
                                                                MarginLeft = 7,
                                                                Text = "标签",
                                                            },
                                                            new DatePicker
                                                            {
                                                                Height = 27,
                                                                Width = 158,
                                                                MarginRight = 8,
                                                            },
                                                        },
                                                        Height = 38,
                                                        Width = 283,
                                                    },
                                                    new Switch
                                                    {
                                                        MarginLeft = 410,
                                                        MarginTop = 165,
                                                        Height = 24,
                                                        Width = 44,
                                                    },
                                                    new TextBox
                                                    {
                                                        MarginLeft = 28,
                                                        MarginTop = 287,
                                                        Height = 131,
                                                        Width = 230,
                                                    },
                                                    new TimePicker
                                                    {
                                                        MarginLeft = 410,
                                                        MarginTop = 209,
                                                    },
                                                    new Button
                                                    {
                                                        Height = 34,
                                                        Width = 89,
                                                        MarginLeft = 411,
                                                        MarginTop = 250,
                                                        Content = "Button",
                                                    },
                                                    new Button
                                                    {
                                                        Classes = "primary",
                                                        MarginLeft = 556,
                                                        MarginTop = 250,
                                                        Height = 34,
                                                        Width = 89,
                                                        Content = "Button",
                                                    },
                                                    new NumericUpDown
                                                    {
                                                        Width = 87,
                                                        MarginLeft = 543,
                                                        MarginTop = 207,
                                                    },
                                                    new StackPanel
                                                    {
                                                        MarginLeft = 410,
                                                        MarginTop = 303,
                                                        IsGroup = true,
                                                        Orientation= Orientation.Horizontal,
                                                        Children =
                                                        {
                                                            new RadioButton
                                                            {
                                                                Content = "上海",
                                                                GroupName="分组1",
                                                            },
                                                            new RadioButton
                                                            {
                                                                Content = "北京",
                                                                GroupName="分组1",
                                                            },
                                                            new RadioButton
                                                            {
                                                                Content = "广州",
                                                                GroupName="分组1",
                                                            }
                                                        },
                                                        Classes = "radioGroup",
                                                    }
                                                },
                                                Height = "100%",
                                                Width = "100%",
                                            },
                                            MarginLeft = 2,
                                            MarginRight = 7,
                                            MarginBottom = 12,
                                            MarginTop = 29,
                                            ShadowColor = "#00000033",
                                            ShadowBlur = 10,
                                            Classes = "widget",
                                        }
                                    },
                                    Height = "100%",
                                    Width = "100%",
                                },
                                Header = new StackPanel
                                {
                                    MarginTop = 0,
                                    MarginLeft = 3,
                                    Orientation = Orientation.Horizontal,
                                    Classes = "imgAndText",
                                    IsGroup = true,
                                    Children =
                                    {
                                        new SVG
                                        {
                                            IsAntiAlias = true,
                                            Fill = "#FFFFFF",
                                            Source = "res://CPFManager/svg/表单.svg",
                                            Classes = "img",
                                            Height = 20,
                                            Width = 20,
                                            Stretch = Stretch.Uniform,
                                        },
                                        new TextBlock
                                        {
                                            MarginLeft = 12f,
                                            Classes = "text",
                                            Text = "表单",
                                        },
                                    },
                                },
                            },
                            new TabItem
                            {
                                Content = new Panel
                                {
                                    Children =
                                    {
                                        new Grid
                                        {
                                            IsGroup = true,
                                            ColumnDefinitions =
                                            {
                                                new ColumnDefinition
                                                {
                                                    
                                                },
                                                new ColumnDefinition
                                                {
                                                    
                                                },
                                            },
                                            Children =
                                            {
                                                new GridSplitter
                                                {
                                                    Height = "100%",
                                                    MarginLeft = 0f,
                                                    ZIndex=1,
                                                    Attacheds =
                                                    {
                                                        {
                                                            Grid.ColumnIndex,
                                                            1
                                                        },
                                                    },
                                                },
                                                new WrapPanel
                                                {
                                                    Children =
                                                    {
                                                        new Button
                                                        {
                                                            Content = "Button",
                                                        },
                                                        new Button
                                                        {
                                                            Content = "Button",
                                                        },
                                                        new Button
                                                        {
                                                            Content = "Button",
                                                        },
                                                        new Button
                                                        {
                                                            Content = "Button",
                                                        },
                                                        new Button
                                                        {
                                                            Content = "Button",
                                                        },
                                                        new Button
                                                        {
                                                            Content = "Button",
                                                        },
                                                        new Button
                                                        {
                                                            Content = "Button",
                                                        },
                                                        new Button
                                                        {
                                                            Content = "Button",
                                                        },
                                                    },
                                                    MarginLeft = 1,
                                                    MarginTop = 0,
                                                    Height = 151,
                                                    Width = "100%",
                                                },
                                                new DockPanel
                                                {
                                                    LastChildFill = true,
                                                    Attacheds =
                                                    {
                                                        {
                                                            Grid.ColumnIndex,
                                                            1
                                                        },
                                                    },
                                                    Width="100%",
                                                    Height="100%",
                                                    Background="#f00",
                                                    Children =
                                                    {
                                                        new Button
                                                        {
                                                            Width = 91,
                                                            Content="DockPanel",
                                                            Attacheds =
                                                            {
                                                                {
                                                                    DockPanel.Dock,
                                                                    Dock.Left
                                                                }
                                                            }
                                                        },
                                                        new Button
                                                        {
                                                            Content="top",
                                                            Width="100%",
                                                            Attacheds =
                                                            {
                                                                {
                                                                    DockPanel.Dock,
                                                                    Dock.Top
                                                                }
                                                            }
                                                        },
                                                        new Button
                                                        {
                                                            Width = 131,
                                                            Content="Right",
                                                            Height="100%",
                                                            Attacheds =
                                                            {
                                                                {
                                                                    DockPanel.Dock,
                                                                    Dock.Right
                                                                }
                                                            }
                                                        },
                                                        new Button
                                                        {
                                                            Content="Bottom",
                                                            Width="100%",
                                                            Attacheds =
                                                            {
                                                                {
                                                                    DockPanel.Dock,
                                                                    Dock.Bottom
                                                                }
                                                            }
                                                        },
                                                        new Button
                                                        {
                                                            Content="center",
                                                            Width="100%",
                                                            Height="100%",
                                                        },
                                                    }
                                                }
                                            },
                                            Height = "100%",
                                            Width = "100%",
                                        }
                                    },
                                    Height = "100%",
                                    Width = "100%",
                                },
                                Header = new StackPanel
                                {
                                    MarginTop = 0,
                                    MarginLeft = 3,
                                    Orientation = Orientation.Horizontal,
                                    Classes = "imgAndText",
                                    IsGroup = true,
                                    Children =
                                    {
                                        new SVG
                                        {
                                            IsAntiAlias = true,
                                            Fill = "#FFFFFF",
                                            Source = "res://CPFManager/svg/布局.svg",
                                            Classes = "img",
                                            Height = 20,
                                            Width = 20,
                                            Stretch = Stretch.Uniform,
                                        },
                                        new TextBlock
                                        {
                                            MarginLeft = 12f,
                                            Classes = "text",
                                            Text = "布局",
                                        },
                                    },
                                },
                            },
                            new TabItem
                            {
                                Content = new Panel
                                {
                                    Children =
                                    {
                                        new TextBox
                                        {
                                            IsUndoEnabled = true,
                                            IsAllowPasteImage = true,
                                            Text = ResourceManager.GetText("res://CPFManager/TextFile1.txt").Result,
                                            Height = "100%",
                                            Width = "100%",
                                            Styles=
                                            {
                                                new DocumentStyle
                                                {
                                                    Foreground = "0,0,255"
                                                },
                                                new DocumentStyle
                                                {
                                                    Foreground = "192,0,0"
                                                },
                                                new DocumentStyle
                                                {
                                                    Foreground = "100,100,100"
                                                }
                                            },
                                            KeywordsStyles=
                                            {
                                                new KeywordsStyle
                                                {
                                                    Keywords = "using |namespace |class |true|new ",
                                                    IsRegex=true,
                                                    StyleId = 0
                                                },
                                                new KeywordsStyle
                                                {
                                                    Keywords = "(\").*(\")",
                                                    IsRegex = true,
                                                    StyleId = 1
                                                },
                                                new KeywordsStyle
                                                {
                                                    Keywords = "(\\\').*(\\\')",
                                                    IsRegex = true,
                                                    StyleId = 2
                                                }
                                            }
                                        },
                                    },
                                    Height = "100%",
                                    Width = "100%",
                                },
                                Header = new StackPanel
                                {
                                    MarginTop = 0,
                                    MarginLeft = 3,
                                    Orientation = Orientation.Horizontal,
                                    Classes = "imgAndText",
                                    IsGroup = true,
                                    Children =
                                    {
                                        new SVG
                                        {
                                            IsAntiAlias = true,
                                            Fill = "#FFFFFF",
                                            Source = "res://CPFManager/svg/文本框.svg",
                                            Classes = "img",
                                            Height = 20,
                                            Width = 20,
                                            Stretch = Stretch.Uniform,
                                        },
                                        new TextBlock
                                        {
                                            MarginLeft = 12f,
                                            Classes = "text",
                                            Text = "TextBox",
                                        },
                                    },
                                },
                            },
                            new TabItem
                            {
                                Content = new Panel
                                {
                                    Children =
                                    {
                                        new Panel
                                        {
                                            MarginLeft = 22,
                                            MarginTop = 21,
                                            IsGroup = true,
                                            Children =
                                            {
                                                new ProgressBar
                                                {
                                                    PresenterFor = this,
                                                    Name = "testProgressBar",
                                                    Value = 50f,
                                                    MarginLeft = 2,
                                                    MarginBottom = 2,
                                                    MarginTop = 2,
                                                    MarginRight = 2,
                                                },
                                                new TextBlock
                                                {
                                                    Bindings =
                                                    {
                                                        {
                                                            nameof(TextBlock.Text),
                                                            nameof(ProgressBar.Value),
                                                            (UIElement owner)=>owner.Parent.Find<ProgressBar>().First(),
                                                            BindingMode.OneWay,
                                                            (float v)=>v.ToString()+"%"
                                                        },
                                                    },
                                                    Text = "0%",
                                                },
                                            },
                                            Height = 30,
                                            Width = 211,
                                        },
                                        new ProgressBar
                                        {
                                            IsIndeterminate = true,
                                            MarginLeft = 308,
                                            MarginTop = 21,
                                            Height = 29,
                                            Width = 197,
                                        },
                                        new ScrollBar
                                        {
                                            Bindings =
                                            {
                                                {
                                                    nameof(ScrollBar.Value),
                                                    "Value",
                                                    FindPresenterByName("testProgressBar"),
                                                    BindingMode.OneWayToSource
                                                },
                                            },
                                            Maximum = 100f,
                                            MarginLeft = 28,
                                            MarginTop = 74,
                                            Width = 206,
                                            Orientation = Orientation.Horizontal,
                                            Height = 12,
                                        },
                                        new Slider
                                        {
                                            MarginLeft = 308,
                                            MarginTop = 68,
                                            Height = 23,
                                            Width = 197,
                                        },
                                        new NumericUpDown
                                        {
                                            MarginLeft = 308,
                                            MarginTop = 124,
                                            Width = 87,
                                        },
                                        new ProgressBar
                                        {
                                            MarginLeft = 28,
                                            MarginTop = 124,
                                            Value = 20f,
                                            Orientation = Orientation.Vertical,
                                            Height = 160,
                                            Width = 27,
                                        },
                                        new Slider
                                        {
                                            MarginLeft = 93,
                                            MarginTop = 124,
                                            Orientation = Orientation.Vertical,
                                            Height = 155,
                                            Width = 26,
                                        },
                                    },
                                    Height = "100%",
                                    Width = "100%",
                                },
                                Header = new StackPanel
                                {
                                    MarginTop = 0,
                                    MarginLeft = 3,
                                    Orientation = Orientation.Horizontal,
                                    Classes = "imgAndText",
                                    IsGroup = true,
                                    Children =
                                    {
                                        new SVG
                                        {
                                            IsAntiAlias = true,
                                            Fill = "#FFFFFF",
                                            Source = "res://CPFManager/svg/文本框.svg",
                                            Classes = "img",
                                            Height = 20,
                                            Width = 20,
                                            Stretch = Stretch.Uniform,
                                        },
                                        new TextBlock
                                        {
                                            MarginLeft = 12f,
                                            Classes = "text",
                                            Text = "值范围控件",
                                        },
                                    },
                                },
                            },
                            new TabItem
                            {
                                Content = new Panel
                                {
                                    Children =
                                    {
                                        new ListBox
                                        {
                                            MarginLeft = 10,
                                            MarginTop = 9,
                                            Height = 266,
                                            Width = 258,
                                            Items =
                                            {
                                                "dgss",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                                "dgss",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                                "dgss",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                            }
                                        },
                                        new ListBox
                                        {
                                            MarginLeft = 369,
                                            MarginTop = 9,
                                            Height = 266,
                                            Width = 258,
                                            ItemTemplate=typeof(ListBoxItemTemplate1),
                                            Items =
                                            {
                                                "dgss",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                                "dgss",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                                "dgss",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                            }
                                        },
                                        new ListBox
                                        {
                                            MarginLeft = 14,
                                            MarginTop = 286,
                                            Height = 238,
                                            Width = 417,
                                            ItemsPanel=new WrapPanel
                                            {
                                                Width="100%"
                                            },
                                            ItemTemplate=typeof(ListBoxItemTemplate),
                                            Items =
                                            {
                                                "dgss",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                                "dgss",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                                "dgss",
                                                "fsdad",
                                                "gdfgs",
                                                "jijfs",
                                                "fgdfa",
                                                "fgdfs",
                                            }
                                        }
                                    },
                                    Height = "100%",
                                    Width = "100%",
                                },
                                Header = new StackPanel
                                {
                                    MarginTop = 0,
                                    MarginLeft = 3,
                                    Orientation = Orientation.Horizontal,
                                    Classes = "imgAndText",
                                    IsGroup = true,
                                    Children =
                                    {
                                        new SVG
                                        {
                                            IsAntiAlias = true,
                                            Fill = "#FFFFFF",
                                            Source = "res://CPFManager/svg/列表.svg",
                                            Classes = "img",
                                            Height = 20,
                                            Width = 20,
                                            Stretch = Stretch.Uniform,
                                        },
                                        new TextBlock
                                        {
                                            MarginLeft = 12f,
                                            Classes = "text",
                                            Text = "列表",
                                        },
                                    },
                                },
                            },
                            new TabItem
                            {
                                Content = new Page1
                                {
                                    Height = "100%",
                                    Width = "100%",
                                },
                                Header = new StackPanel
                                {
                                    MarginTop = 0,
                                    MarginLeft = 3,
                                    Orientation = Orientation.Horizontal,
                                    Classes = "imgAndText",
                                    IsGroup = true,
                                    Children =
                                    {
                                        new SVG
                                        {
                                            IsAntiAlias = true,
                                            Fill = "#FFFFFF",
                                            Source = "res://CPFManager/svg/列表.svg",
                                            Classes = "img",
                                            Height = 20,
                                            Width = 20,
                                            Stretch = Stretch.Uniform,
                                        },
                                        new TextBlock
                                        {
                                            MarginLeft = 12f,
                                            Classes = "text",
                                            Text = "TreeView",
                                        },
                                    },
                                },
                            },
                            new TabItem
                            {
                                Content = new Panel
                                {
                                    Children =
                                    {
                                        new Button
                                        {
                                            Height = 35,
                                            Width = 86,
                                            MarginLeft = 37,
                                            MarginTop = 31,
                                            Content = "Button",
                                        },
                                        new Button
                                        {
                                            MarginLeft = 176,
                                            MarginTop = 31,
                                            Classes = "primary",
                                            Height = 34,
                                            Width = 89,
                                            Content = "Button",
                                        },
                                        new Button
                                        {
                                            MarginLeft = 316,
                                            MarginTop = 31,
                                            Classes = "primary",
                                            Height = 34,
                                            Width = 89,
                                            Content = new StackPanel
                                            {
                                                Orientation = Orientation.Horizontal,
                                                Classes = "imgAndText",
                                                IsGroup = true,
                                                Children =
                                                {
                                                    new Picture
                                                    {
                                                        Source = "res://CPFManager/icon.png",
                                                        Classes = "img",
                                                        Height = 16,
                                                        Width = 16,
                                                        Stretch = Stretch.Uniform,
                                                    },
                                                    new TextBlock
                                                    {
                                                        MarginLeft = 5f,
                                                        Classes = "text",
                                                        Text = "文字",
                                                    },
                                                },
                                            },
                                        },
                                        new Button
                                        {
                                            Classes = "danger",
                                            MarginLeft = 467,
                                            MarginTop = 31,
                                            Height = 58,
                                            Width = 63,
                                            Content = new StackPanel
                                            {
                                                Orientation = Orientation.Vertical,
                                                Classes = "imgAndText",
                                                IsGroup = true,
                                                Children =
                                                {
                                                    new Picture
                                                    {
                                                        Source = "res://CPFManager/icon.png",
                                                        Classes = "img",
                                                        Height = 16,
                                                        Width = 16,
                                                        Stretch = Stretch.Uniform,
                                                    },
                                                    new TextBlock
                                                    {
                                                        MarginTop = 5f,
                                                        Classes = "text",
                                                        Text = "文字11",
                                                    },
                                                },
                                            },
                                        },
                                        new Button
                                        {
                                            Classes = "success",
                                            Height = 34,
                                            Width = 87,
                                            MarginLeft = 37,
                                            MarginTop = 95,
                                            Content = "Button",
                                        },
                                        new Button
                                        {
                                            Classes = "danger",
                                            MarginLeft = 176,
                                            MarginTop = 94,
                                            Height = 35,
                                            Width = 86,
                                            Content = "Button",
                                        },
                                        new Button
                                        {
                                            MarginLeft = 304,
                                            MarginTop = 94,
                                            Height = 38,
                                            Width = 106,
                                            Content = new Panel
                                            {
                                                IsGroup = true,
                                                Children =
                                                {
                                                    new Button
                                                    {
                                                        Width = 26,
                                                        Height = "100%",
                                                        MarginRight = 0,
                                                        Content = new Polyline
                                                        {
                                                            Points =
                                                            {
                                                                {
                                                                    0,
                                                                    0
                                                                },
                                                                {
                                                                    5,
                                                                    5
                                                                },
                                                                {
                                                                    10,
                                                                    0
                                                                }
                                                            },
                                                            IsAntiAlias=true
                                                        },
                                                        ContextMenu=new ContextMenu
                                                        {
                                                            Items =
                                                            {
                                                                new MenuItem
                                                                {
                                                                    Header="123"
                                                                },
                                                                new Separator
                                                                {
                                                                    
                                                                },
                                                                new MenuItem
                                                                {
                                                                    Header="1233423",
                                                                    Items =
                                                                    {
                                                                        new MenuItem
                                                                        {
                                                                            Header="45242"
                                                                        }
                                                                    }
                                                                },
                                                            }
                                                        },
                                                        Commands =
                                                        {
                                                            {
                                                                nameof(Button.MouseUp),
                                                                (s,e)=>
                                                                {
                                                                    var E=e as MouseButtonEventArgs;
                                                                    if (E.MouseButton== MouseButton.Left)
                                                                    {
                                                                        var cm = (s as UIElement).ContextMenu;
                                                                        if (cm != null)
                                                                        {
                                                                            cm.DataContext = DataContext;
                                                                            cm.CommandContext = CommandContext;
                                                                            cm.PlacementTarget = s as UIElement;
                                                                            cm.Placement=  PlacementMode.Padding;
                                                                            cm.PopupMarginLeft=0;
                                                                            cm.PopupMarginTop="100%";
                                                                            cm.IsOpen = true;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        E.Handled=true;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    },
                                                    new TextBlock
                                                    {
                                                        MarginLeft = 11,
                                                        Text = "带下拉菜单",
                                                    },
                                                },
                                                Height = "100%",
                                                Width = "100%",
                                            },
                                        },
                                        new Button
                                        {
                                            MarginLeft = 37,
                                            MarginTop = 174,
                                            Height = 36,
                                            Width = 127,
                                            Content = new Panel
                                            {
                                                IsGroup = true,
                                                Children =
                                                {
                                                    new TextBlock
                                                    {
                                                        MarginLeft = 11,
                                                        Text = "带下拉菜单",
                                                    },
                                                    new Polyline
                                                    {
                                                        MarginRight = 11,
                                                        Points =
                                                        {
                                                            {
                                                                0,
                                                                0
                                                            },
                                                            {
                                                                5,
                                                                5
                                                            },
                                                            {
                                                                10,
                                                                0
                                                            }
                                                        },
                                                        IsAntiAlias=true
                                                    }
                                                },
                                                Height = "100%",
                                                Width = "100%",
                                            },
                                            ContextMenu=new ContextMenu
                                            {
                                                Items =
                                                {
                                                    new MenuItem
                                                    {
                                                        Header="123"
                                                    },
                                                    new Separator
                                                    {
                                                        
                                                    },
                                                    new MenuItem
                                                    {
                                                        Header="1233423",
                                                        Items =
                                                        {
                                                            new MenuItem
                                                            {
                                                                Header="45242"
                                                            }
                                                        }
                                                    },
                                                }
                                            },
                                            Commands =
                                            {
                                                {
                                                    nameof(Button.MouseUp),
                                                    (s,e)=>
                                                    {
                                                        var E=e as MouseButtonEventArgs;
                                                        if (E.MouseButton== MouseButton.Left)
                                                        {
                                                            var cm = (s as UIElement).ContextMenu;
                                                            if (cm != null)
                                                            {
                                                                cm.DataContext = DataContext;
                                                                cm.CommandContext = CommandContext;
                                                                cm.PlacementTarget = s as UIElement;
                                                                cm.Placement=  PlacementMode.Padding;
                                                                cm.PopupMarginLeft=0;
                                                                cm.PopupMarginTop="100%";
                                                                cm.IsOpen = true;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            E.Handled=true;
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                    },
                                    Height = "100%",
                                    Width = "100%",
                                },
                                Header = new StackPanel
                                {
                                    MarginTop = 0,
                                    MarginLeft = 3,
                                    Orientation = Orientation.Horizontal,
                                    Classes = "imgAndText",
                                    IsGroup = true,
                                    Children =
                                    {
                                        new SVG
                                        {
                                            IsAntiAlias = true,
                                            Fill = "#FFFFFF",
                                            Source = "res://CPFManager/svg/按钮.svg",
                                            Classes = "img",
                                            Height = 20,
                                            Width = 20,
                                            Stretch = Stretch.Uniform,
                                        },
                                        new TextBlock
                                        {
                                            MarginLeft = 12f,
                                            Classes = "text",
                                            Text = "按钮",
                                        },
                                    },
                                },
                            },
                            new TabItem
                            {
                                Content = new Panel
                                {
                                    Children =
                                    {
                                        new Button
                                        {
                                            MarginLeft = 365,
                                            MarginTop = 19,
                                            Content = "打开文件对话框",
                                            Width=100,
                                            Height=30,
                                            Commands=
                                            {
                                                {
                                                    nameof(Button.Click),
                                                    async (s,e)=>
                                                    {
                                                        var f=new OpenFileDialog();
                                                        f.Filters.Add(new FileDialogFilter
                                                        {
                                                            Name="图片",
                                                            Extensions="jpg,png,gif"
                                                        });
                                                        var sf=await f.ShowAsync(this);
                                                    }
                                                }
                                            }
                                        },
                                        new Button
                                        {
                                            MarginLeft = 187,
                                            MarginTop = 19,
                                            Content = "选择目录对话框",
                                            Width=100,
                                            Height=30,
                                            Commands=
                                            {
                                                {
                                                    nameof(Button.Click),
                                                    async (s,e)=>
                                                    {
                                                        var sf=await new OpenFolderDialog().ShowAsync(this);
                                                    }
                                                }
                                            }
                                        },
                                        new Button
                                        {
                                            MarginLeft = 27,
                                            MarginTop = 19,
                                            Content = "保存文件对话框",
                                            Width=100,
                                            Height=30,
                                            Commands=
                                            {
                                                {
                                                    nameof(Button.Click),
                                                    async (s,e)=>
                                                    {
                                                        var f=new SaveFileDialog();
                                                        var sf= await f.ShowAsync(this);
                                                    }
                                                }
                                            }
                                        },
                                        new Button
                                        {
                                            MarginLeft = 524,
                                            MarginTop = 19,
                                            Content = "模态窗体",
                                            Width=100,
                                            Height=30,
                                            Commands=
                                            {
                                                {
                                                    nameof(Button.Click),
                                                    async (s,e)=>
                                                    {
                                                        var f=new Window();
                                                        f.Background=null;
                                                        f.Width=300;
                                                        f.Height=300;
                                                        f.CanResize=true;
                                                        f.Children.Add(new WindowFrame(f,new Button
                                                        {
                                                            Content="test"
                                                        }));
                                                        await f.ShowDialog();
                                                    }
                                                }
                                            }
                                        },
                                        new Button
                                        {
                                            MarginLeft = 27,
                                            MarginTop = 87,
                                            Content = "默认MessageBox",
                                            Width=126,
                                            Height=30,
                                            Commands=
                                            {
                                                {
                                                    nameof(Button.Click),
                                                    async (s,e)=>
                                                    {
                                                        await MessageBox.Show("弹窗");
                                                    }
                                                }
                                            }
                                        },
                                        new Button
                                        {
                                            Commands =
                                            {
                                                {
                                                    "Click",
                                                    nameof(ShowLayerDialog),
                                                    this,
                                                    CommandParameter.EventSender,
                                                    CommandParameter.EventArgs
                                                },
                                            },
                                            Height = 31,
                                            Width = 104,
                                            MarginLeft = 232,
                                            MarginTop = 87,
                                            Content = "弹出层对话框",
                                        },
                                    },
                                    Height = "100%",
                                    Width = "100%",
                                },
                                Header = new StackPanel
                                {
                                    MarginTop = 0,
                                    MarginLeft = 3,
                                    Orientation = Orientation.Horizontal,
                                    Classes = "imgAndText",
                                    IsGroup = true,
                                    Children =
                                    {
                                        new SVG
                                        {
                                            IsAntiAlias = true,
                                            Fill = "#FFFFFF",
                                            Source = "res://CPFManager/svg/对话框.svg",
                                            Classes = "img",
                                            Height = 20,
                                            Width = 20,
                                            Stretch = Stretch.Uniform,
                                        },
                                        new TextBlock
                                        {
                                            MarginLeft = 12f,
                                            Classes = "text",
                                            Text = "对话框",
                                        },
                                    },
                                },
                            },
                            new TabItem
                            {
                                Content = new Panel
                                {
                                    Children =
                                    {
                                        new Button
                                        {
                                            Commands =
                                            {
                                                {
                                                    nameof(Button.Click),
                                                    "ScreenCapture",
                                                    null,
                                                    this
                                                }
                                            },
                                            Height = 33,
                                            Width = 83,
                                            MarginTop = 14,
                                            Content = "截图",
                                        },
                                        new ScrollViewer
                                        {
                                            MarginBottom = 29,
                                            MarginRight = 25,
                                            MarginLeft = 25,
                                            MarginTop = 58,
                                            Content=new Picture
                                            {
                                                Bindings =
                                                {
                                                    {
                                                        nameof(Picture.Source),
                                                        "Screenshot"
                                                    },
                                                },
                                            }
                                        },
                                    },
                                    Height = "100%",
                                    Width = "100%",
                                },
                                Header = new StackPanel
                                {
                                    MarginTop = 0,
                                    MarginLeft = 3,
                                    Orientation = Orientation.Horizontal,
                                    Classes = "imgAndText",
                                    IsGroup = true,
                                    Children =
                                    {
                                        new SVG
                                        {
                                            IsAntiAlias = true,
                                            Fill = "#FFFFFF",
                                            Source = "res://CPFManager/svg/截图.svg",
                                            Classes = "img",
                                            Height = 20,
                                            Width = 20,
                                            Stretch = Stretch.Uniform,
                                        },
                                        new TextBlock
                                        {
                                            MarginLeft = 12f,
                                            Classes = "text",
                                            Text = "屏幕截图",
                                        },
                                    },
                                },
                            },
                        },
                        MarginLeft = 0,
                        MarginTop = 0,
                        Height = "100%",
                        Width = "100%",
                    },
                    new Panel
                    {
                        Commands =
                        {
                            {
                                "MouseDown",
                                nameof(ClickShowOrHide),
                                this,
                                CommandParameter.EventSender,
                                CommandParameter.EventArgs
                            },
                        },
                        PresenterFor = this,
                        Name = "showBtn",
                        Height = 40,
                        Width = 40,
                        MarginLeft = 7,
                        MarginTop = 6,
                        Children =
                        {
                            new SVG
                            {
                                MarginLeft = 9,
                                MarginTop = 9,
                                Fill = "#FFFFFF",
                                Height = 20,
                                IsAntiAlias = true,
                                Width = 20,
                                Stretch = Stretch.Uniform,
                                Source="<svg t=\"1620137523704\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"1597\" width=\"16\" height=\"16\"><path d=\"M832 256 192 256C153.6 256 128 230.4 128 192l0 0c0-38.4 25.6-64 64-64l640 0c38.4 0 64 25.6 64 64l0 0C896 230.4 870.4 256 832 256z\" p-id=\"1598\"></path><path d=\"M832 576 192 576C153.6 576 128 550.4 128 512l0 0c0-38.4 25.6-64 64-64l640 0c38.4 0 64 25.6 64 64l0 0C896 550.4 870.4 576 832 576z\" p-id=\"1599\"></path><path d=\"M832 896 192 896c-38.4 0-64-25.6-64-64l0 0c0-38.4 25.6-64 64-64l640 0c38.4 0 64 25.6 64 64l0 0C896 870.4 870.4 896 832 896z\" p-id=\"1600\"></path></svg>"
                            }
                        },
                    }
                }
            })
            {
                ShowIcon = false,
                MaximizeBox = true,
            });
            if (!DesignMode)//设计模式下不执行，也可以用#if !DesignMode
            {
                
            }
            Children.Add(new TextBlock
            {
                PresenterFor = this,
                Name = "titleText",
                FontSize = 14f,
                Foreground = "#FFFFFF",
                MarginLeft = 54,
                MarginTop = 15,
                Text = "XX管理系统",
            });
        }

        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);
            if (!DesignMode)
            {
                CPF.Platform.Application.Exit();
            }
        }

        [PropertyMetadata(true)]
        public bool ShowOrHide
        {
            get { return GetValue<bool>(); }
            set { SetValue(value); }
        }

        void ClickShowOrHide(CpfObject obj, MouseButtonEventArgs eventArgs)
        {
            ShowOrHide = !ShowOrHide;
        }
        void ShowLayerDialog(CpfObject obj, RoutedEventArgs eventArgs)
        {
            var d = new BaseDialog();
            d.Content = new Button { Content = "测试" };
            d.ShowDialog(this);
        }
    }
}
